import requests


def post_request(post_url, post_data, on_success, on_error):
    try:
        return_response = requests.post(post_url, json=post_data)

        if return_response.status_code == 200:
            print("Response:", return_response.json())
            on_success(return_response.json())
        else:
            print(f"Error: {return_response.status_code}, {return_response.text}")
            on_error(return_response.status_code, return_response.text)
    except requests.exceptions.RequestException as e:
        print(f"Request failed: {e}")
        on_error("Request failed", str(e))
